package com.xjrsoft.module.version.controller;

import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.module.version.dto.ExportDataDto;
import com.xjrsoft.module.version.service.IDataSyncService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;

import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;




/**
 * 系统配置
 * @Author: lxl
 * @Date: 2024/7/1 14:13
 */
@RestController
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/datasync")
@Api(value = GlobalConstant.SYSTEM_MODULE_PREFIX + "/datasync", tags = "数据同步")
@AllArgsConstructor
public class DataSyncController {

    private final IDataSyncService versionManagerService;

    @PostMapping("/export")
    @ApiOperation("导出数据")
    public R export(@RequestBody ExportDataDto exportDataDto){

        String exportData=  versionManagerService.exportData(exportDataDto);
        return R.ok(exportData);
    }
    @PostMapping("/import")
    @ApiOperation(value = "导入流程")
    @SneakyThrows
    public R importSchema(@RequestParam(value = "file") MultipartFile multipartFile) {
        return R.ok(versionManagerService.importData(multipartFile));
    }
 

}
